﻿
@model QLMB.ViewModels.RouteInfo

@{
    ViewBag.Title = "Create Flight";
}

@section script {
    <script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
}
<script language = "javascript" type ="text/javascript">
    $(document).ready(function () {
        $("#MayBay").change(function () {
            if ($(this).val() != 0)
                $(this).attr("class", "valid");
            else
                $(this).attr("class", "input-validation-error");

        });

    });
    document..$("#ThoiGianGianCach_2_").value = 3;
</script>

<h2>CreateFlight</h2>

    <div class = "form" id = "form" style="position: fixed; width: 700px">
    @using (Html.BeginForm())
    {
    <b>@Html.LabelFor(x => x.MaDb):</b>
    @Html.Label(Model.MaDb) <br />

    <span><b>@Html.LabelFor(x => x.TpDi):</b></span>
    <span>@Html.Label(Model.TpDi)</span>

    <span><b>@Html.LabelFor(x => x.TpDen):</b></span>
    <span>@Html.Label(Model.TpDen)</span> <br />
    
    <span> <b>Giờ bay:</b></span>
    <span>@Html.Label(Model.Ngay.ToString())</span>
        
    <span> <b>@Html.LabelFor(x => x.thoigianbay):</b></span>
    <span>@Html.Label(Model.thoigianbay.ToString())
    phút </span>   
        
    <span> <b>@Html.LabelFor(x => x.loaidb):</b></span>
    <span>@Html.Label(Model.loaidb)</span>   <br />
    <h3>Danh sách chuyến bay</h3>   
        <table>
        <tr>
        <th>Sân bay đi</th>
        <th>Sân bay đến</th>
        <th>Hãng khai thác</th>
        <th>Thời gian bay</th>
        <th>Ngày đi</th>
        <th>Ngày đến</th>
        <th>Máy bay</th>
        </tr>
    @{
        int num =0;
        foreach (var sb in Model.dsSanBay)
        {
            <tr>
            <td>@Html.Label(sb.SbDi)</td>
            <td>@Html.Label(sb.SbDen)</td>
            <td>@Html.Label(sb.HangKhaiThac)</td>
            <td>@Html.Label(sb.ThoiGianBay.ToString()) phút</td>
            <td>@Html.Label(sb.NgayDi.ToString())</td>
            <td>@Html.Label(sb.NgayDen.ToString())</td>
            @{
                if (sb.Maybay != 0)
                {
                    <td>
                    @Html.DropDownListFor(x => x.MayBay, new SelectList(Model.DsMayBay, "Value", "Text"), "  ")<br />
                    @Html.ValidationMessageFor(x => x.MayBay)
                    </td>
                }
                else
                {
                 <td> </td>
                }
            }
            </tr>
        }
    }
    </table>
    <input type="submit" value="Tạo chuyến bay"/>
    }
    </div>
    

    @{
        if (Model.Ngay <= DateTime.Now.AddDays(4))
        {
            @Html.Label("Test1");
        }
        
                
    }

    

